package vivace.view.openDialogue;

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;

/**
 * A class to view developer chosen icons for certain files in the open dialogue
 */
public class ImageFileView extends FileView {

	// The Icon/Icons to be used
	ImageIcon midiIcon = Utils.createImageIcon("images/midiIconSmall.png");


	public String getName(File f) {
		return null; //let FileView figure this out
	}

	public String getDescription(File f) {
		return null; //let FileView figure this out
	}

	public Boolean isTraversable(File f) {
		return null; //let FileView figure this out
	}

	/**
	 * Get the type of File
	 * 
	 * @param 	File 	file		file for view
	 * @return	String	type	returns the type of the file
	 */
	public String getTypeDescription(File f) {

		//Load the extensions to be filtered
		String extension = Utils.getExtension(f);
		String type = null;

		//If there is extensions to filter, find out wich type
		if (extension != null) {

			if (extension.equals(Utils.mid)) {
				
				type = "MIDI File";
				//} else if (extension.equals(Utils.mid)){

				//insert another format here if needed
				//}
			}

		}
		return type;
	}

	/**
	 * Enumerator that explains the supported operations for this class.	
	 * 
	 * @param 	File 	f		file for view
	 * @return	Icon	icon	returns the icon to show
	 */
	public Icon getIcon(File file) {

		//Load the extensions to be filtered
		String extension = Utils.getExtension(file);
		Icon icon = null;

		//If there is extensions to filter, find out wich type
		if (extension != null) {

			if (extension.equals(Utils.mid)) {
				icon = midiIcon;
				//} else if (extension.equals(Utils.mid)){

				//insert another format here if needed
				//}
			}

		}
		return icon;
	}
}